Ext.ns('Audit.Report');
Audit.Report.reportRetrive =Ext.extend(Ext.Window,{
     modal:true
     ,title:'收入挽回报告'
     ,width:800
     ,height:425
     //,autoScroll:true
     ,autoScroll:true
	 ,enableDragDrop: false
	 ,padding:'10px'
	 ,fields:['bizType','serialNumber','userId','eparchyCode','startDate'
   		               ,'startTime','endDate','endTime','callDuration','dataUp','saveIncome']
   	 ,columns:[new Ext.grid.RowNumberer({header:'序号	',width:40}),{
				header:'严重级别',
				dataIndex:"bizType",
				width:150
				},{
				header:'严重级别',
				dataIndex:"serialNumber",
				width:150
				},{
				header:'严重级别',
				dataIndex:"userId",
				width:150
				},{
				header:'严重级别',
				dataIndex:"saveIncome",
				width:150
				}]	               
     ,initComponent:function(){
     	var me =this;
     	var store =new Ext.data.JsonStore({
     	    fields:this.root[1]
     	});
     	store.loadData(this.root[3]);
     	var limit =11;
     	var cols =this.root[2];
     	for(var i=0;i<cols.length;i++) {
     	    var col =cols[i];
     	    if (Ext.isString(col)){
     	    	cols[i] =Ext.decode(col);
     	    } else {
     	    	for(var r in col) {
     	    	     if (r =="renderer"){
     	    	     	cols[i].renderer=Ext.decode(col[r]);
     	    	     }
     	    	}
     	    }
     	}
     	var gp ={
     	   xtype:'grid'
     	   ,store:store
     	   ,autoHeight:true
     	   ,columnLines:true
     	   ,viewConfig:{
     	       headerAlign:'center'
     	       ,cellAlign:'right'
     	   }
     	   ,columns:this.root[2]
     	}
     	this.gp =gp;
     	this.items=[{xtype:'box',style:{paddingBottom:'10px',marginLeft:0},html:'<font size=4><b>'+this.root[0]+'稽核报告如下：</b></font>'},gp
     	           ,{xtype:'box',style:{padding:'10px',textAlign:'right'},html:'<font size=3>报告时间:'+new Date().format('Y-m-d H:i:s')+'</font>'}];
     	Audit.Report.reportRetrive.superclass.initComponent.call(this);
     }
});
Audit.Report.reportRetrive.show =function(params){
	Ext.Ajax.request({
   		   url:'retrive_getReportRetrive.action'
   		   ,params:params
   		    ,success:function(result,request) {
   		       var page =Ext.decode(result.responseText);
   		       if (page.success) {
	   		       var root =page.root;
	   		       if(root.length>0) {
	   		         new Audit.Report.reportRetrive({root:root}).show();
	   		       } else {
	   		       	 	MsgTip.msg({msg:"没有统计规则数据,不能生成报告",pos:'center',type:'error'}); 
	   		       }
   		       } else {
   		       	MsgTip.msg({msg:page.info,pos:'center'});
   		       }
   		    }
   		});
};